package erp.education.server.db.implementation.setup.school;

 

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Component;

import erp.education.server.db.entites.setup.school.Branchs;
import erp.education.server.db.entites.setup.school.Schools;
import erp.education.server.db.implementation.common.BaseDAO;
import erp.education.server.db.interfaces.setup.school.BranchsDAOI;
@Component("branchsDao")
public class BranchsDAO extends BaseDAO implements BranchsDAOI {

	@Override
	public Branchs getBranch(Long schoolId,String branchName) {
		// TODO Auto-generated method stub
		Branchs school=null;
		Map params=new HashMap();
		params.put("branchName", branchName);
		params.put("schoolId", schoolId);
		
		school=(Branchs)getSingleResult("select branch from Branchs branch where branch.schoolId=:schoolId and branch.branchName=:branchName", params);
	 
		 
		 
		return school;
	}
	@Override
	public List<Object[]> getBranchList() {
		// TODO Auto-generated method stub
		List<Object[]> branchs=null;
		Map params=new HashMap();
		branchs=(List<Object[]>) getResultList("select branch.schoolId,school.schoolName,branch.branchId,branch.branchName,branch.phoneNo,branch.faxNo,branch.emailId,branch.address from Schools school,Branchs branch where branch.schoolId=school.schoolId  ", params);
			return branchs;
	}
	@Override
	public List<Branchs> getBranchs() {
		// TODO Auto-generated method stub
		List<Branchs> branchs=null;
		Map params=new HashMap();
		branchs=(List<Branchs>) getResultList("select branch from Branchs branch ", params);
			return branchs;
 
	}
}
